package com.hdaccp.letting.controller;

import com.hdaccp.letting.bean.User;
import com.hdaccp.letting.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@RequestMapping("/user")
public class UserController {
    @Resource
    private UserService userService ;
    @RequestMapping("/getUser")
    @ResponseBody
    public User getUser(int id){
        User user = userService.getUser(id) ;
        if (user==null){
            user = new User() ;
            user.setId(0) ;
            user.setName("默认用户");
            user.setAddress("邯郸");
        }
        return user ;
    }
}
